package com.jhhc.BDMS.File.ServiceImpl;

import com.jhhc.BDMS.File.Dao.BDMS_SYS_FILE_DMapper;
import com.jhhc.BDMS.File.Pojo.BDMS_SYS_FILE_D;
import com.jhhc.BDMS.File.Server.BDMS_SYS_FILE_DService;
import org.springframework.stereotype.Service;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.data.domain.PageRequest;

import javax.annotation.Resource;
import java.util.List;

/**
 * (BdmsSysFileD)表服务实现类
 *
 * @author makejava
 * @since 2023-07-05 14:32:11
 */
@Service
public class BDMS_SYS_FILE_DServiceImpl implements BDMS_SYS_FILE_DService {
    @Resource
    private BDMS_SYS_FILE_DMapper BDMSSYSFILEDMapper;

    /**
     * 通过ID查询单条数据
     *
     * @param pid 主键
     * @return 实例对象
     */
    @Override
    public BDMS_SYS_FILE_D queryById(Integer pid,String fileid) {
        return BDMSSYSFILEDMapper.queryById(pid,fileid);
    }

    @Override
    public List<BDMS_SYS_FILE_D> queryAll(Integer pid) {
        return BDMSSYSFILEDMapper.queryAll(pid);
    }

    /**
     * 分页查询
     *
     * @param bdmsSysFileD 筛选条件
     * @param pageRequest  分页对象
     * @return 查询结果
     */
    @Override
    public Page<BDMS_SYS_FILE_D> queryByPage(BDMS_SYS_FILE_D bdmsSysFileD, PageRequest pageRequest) {
        long total = this.BDMSSYSFILEDMapper.count(bdmsSysFileD);
        return new PageImpl<>(this.BDMSSYSFILEDMapper.queryAllByLimit(bdmsSysFileD, pageRequest), pageRequest, total);
    }

    /**
     * 新增数据
     *
     * @param bdmsSysFileD 实例对象
     * @return 实例对象
     */
    @Override
    public int insert(BDMS_SYS_FILE_D bdmsSysFileD) {

        return  BDMSSYSFILEDMapper.insert(bdmsSysFileD);
    }

    @Override
    public BDMS_SYS_FILE_D update(BDMS_SYS_FILE_D bdmsSysFileD) {
        return null;
    }

    @Override
    public int deleteById(Integer pid, String fileId) {
        return BDMSSYSFILEDMapper.deleteByIds(pid,fileId);
    }

    @Override
    public List<BDMS_SYS_FILE_D> queryByFileIds(Integer pid, List<String> fileIds) {
        return BDMSSYSFILEDMapper.queryByFileIds(pid, fileIds);
    }

    /**
     * 修改数据
     *
     * @param bdmsSysFileD 实例对象
     * @return 实例对象
     */


    /**
     * 通过主键删除数据
     *
     * @param pid 主键
     * @return 是否成功
     */

}
